package com.borrower.action;

import com.admin.dao.bordao.BorDao;
import com.admin.dao.bordao.BorDaoImpl;
import com.admin.service.borservice.BorServiceImpl;
import com.borrower.service.BorrowerServiceImpl;
import com.google.gson.Gson;
import com.pojo.BorrowerBean;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

/**
 * 由reader_borrow_books.html传来的身份证号获取borrow的信息
 */
public class AjaxReturnBorInfoAction extends Action {
    @Override
    public void execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String idCard = request.getParameter("idcard");

        PrintWriter out = response.getWriter();

        List<BorrowerBean> list;

        BorrowerBean bb=new BorrowerBean();

        bb.setIdCard(idCard);

        BorrowerServiceImpl borService = new BorrowerServiceImpl();

        list=borService.getBorInfoByIdCard(bb);

        Gson gson = new Gson();

        String strJson = gson.toJson(list);
        System.out.println("90909090"+strJson);

        out.print(strJson);

    }
}
